//
//  ConstructionViewController.m
//  mhome
//
//  Created by 刘春雷 on 2018/11/28.
//  Copyright © 2018年 刘春雷. All rights reserved.
//

#import "ConstructionViewController.h"
#import "ElectricityViewController.h"
#import "WaterwayViewController.h"
#import "WetViewController.h"
#import "WoodworkViewController.h"
#import "PainterViewController.h"
#import "FixViewController.h"
#import "UIImage+LX.h"

@interface ConstructionViewController ()<UITableViewDelegate,UITableViewDataSource>
@property(nonatomic,strong)NSArray *array;
@property(nonatomic,strong)UITableView *tableView;
@end

@implementation ConstructionViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"施工";
    self.array = @[@"电路工程",@"水路工程",@"泥工工程",@"木工工程",@"油漆工程",@"安装工程"];
    self.tableView = [[UITableView alloc]initWithFrame:[UIScreen mainScreen].bounds style:UITableViewStyleGrouped];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    [self.view addSubview:self.tableView];
    [self setupNavBar];
}
- (void)setupNavBar {
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:18],NSForegroundColorAttributeName:[UIColor whiteColor]}];
    self.navigationController.navigationBar.translucent = NO;
    [self.navigationController.navigationBar setBackgroundImage:[UIImage getImageWithColor:[UIColor qmui_colorWithHexString:@"4bccbc"]] forBarMetrics:UIBarMetricsDefault];
    [self.navigationController.navigationBar setShadowImage:[[UIImage alloc] init]];
}
#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.array.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    return 0.01;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    return nil;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if(cell == nil){
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
    }
    cell.textLabel.text = self.array[indexPath.row];
    cell.selectionStyle=UITableViewCellSelectionStyleNone;//取消cell 的点击效果
    return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    if(indexPath.row == 0){
        ElectricityViewController *electricityViewController = [[ElectricityViewController alloc]init];
        electricityViewController.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:electricityViewController animated:YES];
    }else if (indexPath.row == 1){
        WaterwayViewController *waterwayViewController = [[WaterwayViewController alloc]init];
        waterwayViewController.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:waterwayViewController animated:YES];
    }else if (indexPath.row == 2){
        WetViewController *wetViewController = [[WetViewController alloc]init];
        wetViewController.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:wetViewController animated:YES];
    }else if(indexPath.row == 3){
        WoodworkViewController *woodworkViewController = [[WoodworkViewController alloc]init];
        woodworkViewController.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:woodworkViewController animated:YES];
    }else if (indexPath.row == 4) {
        PainterViewController *painterViewController = [[PainterViewController alloc]init];
        painterViewController.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:painterViewController animated:YES];
    }else{
        FixViewController *fixViewController = [[FixViewController alloc]init];
        fixViewController.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:fixViewController animated:YES];
    }
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
